
$test: 1px solid red !important;

$legend: 16px;
$legend-weight: normal;

$narrow-spacing: 4px;
$default-spacing: 15px;
$default-size: 15px;
$input-spacing: 10px;
$condensed-spacing: 4px;

$x-small: 80px;
$small: 250px;
$medium: 450px;
$default: 550px;
$large: 650px;
$x-large: 850px;

$inline-input-margin: 0 15px 0 0;
$stacked-left-inputs-margin: 0 15px 0 0;
$stacked-right-inputs-margin: 0 0 0 15px;

/*$background-color: green;*/
$background-color: rgb(246,246,246);
$foreground-color: white;
$input-background-color: white;
$form-border-thickness: 1px;
$form-border-style: solid;
$form-border-color: #ddd;
$form-border: 1px solid #ddd;

/* All forms */

/*.form-vertical * {
    border: 1px solid black !important;
}*/

form ol, form ul, form fieldset {
    padding: 0 !important;
    margin: 0 !important;
}

form {
    
    ol, ul, fieldset {
        padding: 0 !important;
        margin: 0 !important;
    }
    
    .control-group {
        padding: 0;
    }
    
    label.control-label {
        margin: 0;
        padding: 0;
    }
    
    label.control-label.label-normal {
        font-weight: normal;
    }
    
    .form-group > label.control-label {
        padding-left: 0;
    }
    
    legend {
        font-weight: bold;
    }
    
    legend.legend-normal {
        font-weight: normal;
    }
    
    legend.align-left,
    .form-group > label.control-label.align-left {
        text-align: left;
    }
    
    legend.align-center,
    .form-group > label.control-label.align-center {
        text-align: center;
    }
    
    legend.align-right,
    .form-group > label.control-label.align-right {
        text-align: right;
    }

    label.control-label small {
        font-weight: normal;
    }
    
    .input-size {
        padding: 0;
    }
    
    ol, ul, li {
        list-style-type: none;
        list-style-position: outside;
    }
    
    ol, ul li.form-group {
        margin: 0 !important;
    }
    
    .help-block {
        padding: 0;
        margin: 0;
    }

    .input-size.x-small {
        max-width: $x-small;
    }
    .input-size.small {
        max-width: $small;
    }
    .input-size.medium {
        max-width: $medium;
    }
    .input-size.default {
        max-width: $default;
    }
    .input-size.large {
        max-width: $large;
    }
    .input-size.x-large {
        max-width: $x-large;
    }
    
    .submit-group {
        padding: $default-spacing;
    }
    
}

.no-legend legend {
    display: none;
}

form.normal-label .control-label {
    font-weight: normal !important;
}

/* ========================================================== Form Horizontal === */

form.form-horizontal {
    
    .form-group {
        margin-bottom: $input-spacing !important;
    }
    
    .form-group > label.control-label {
        padding-right: $default-spacing;
        padding-top: 8px;
    }
    
    legend {
        font-size: $legend;
        // font-weight: $legend-weight;
        border-bottom: 0;
        margin-bottom: 5px;
    }
    
    .control-group .input-size.align-center {
        float: none;
        margin: 0 auto;
    }
    
    .control-group .form-control-feedback {
        z-index: 5;
    }
    
}

form.form-horizontal.form-bordered {
    
    legend {
        border-top: $form-border;
        border-right: $form-border;
        border-left: 0;
        border-bottom: 0;
        margin-bottom: 0;
        padding: 10px 0 10px 10px;
    }
    
    fieldset:first-of-type legend {
        border-left: $form-border;
    }
    
    .form-group {
        margin: 0 !important;
        border: $form-border;
        border-bottom: 0;
        background-color: $background-color;
    }
    
    .form-group:last-child {
        border-bottom: $form-border;
    }
    
    .form-group > label.control-label {
        padding-left: $default-spacing;  
    }
    
    .control-group {
        padding: 10px;
        border-left: $form-border;

        @media (max-width: 768px) {
             border-left: 0;
        }
        background-color: $foreground-color;
    }
}

form.form-horizontal.form-bordered.form-striped {
    .form-group:nth-child(2n+1) {
        background-color: $background-color;
    }
    
    .form-group:nth-child(2n+1) .control-group {
        background-color: $background-color;
    }
}

form.form-horizontal.form-bordered.form-column {

    .form-group {
        border-left: 0;
    }

    fieldset:first-of-type .form-group {
        border-left: $form-border;
    }
}

form.form-horizontal.form-condensed {
    
    legend {
        margin-bottom: 0;
    }
    .form-group {
        margin-bottom: 0 !important;
    }
    .control-label {
        padding: $narrow-spacing !important;
    }
    .control-group {
        padding: $narrow-spacing;
        padding-top: 0 !important;
    }
    .submit-group {
        padding: $narrow-spacing;
    }
}

form.form-horizontal.form-bordered.form-condensed {
    
    legend {
        border-top: $form-border;
        border-right: $form-border;
        border-left: 0;
        border-bottom: 0;
        margin-bottom: 0;
        padding: $condensed-spacing 0 $condensed-spacing $condensed-spacing;
    }
    
    fieldset:first-of-type legend {
        border-left: $form-border;
    }
    
    .control-group {
        padding-top: $narrow-spacing !important;
    }
}

.form-container.no-padding {
    
    form.form-horizontal.form-bordered {
        
        legend {
            padding-left: $default-spacing;
            padding-right: $default-spacing;
        }
        
        .form-group {
            border-left: 0;
            border-right: 0;
        }
        
    }
 
    form.form-horizontal.form-bordered.form-column {
        .form-group {
            border-right: $form-border;
        }
        
        fieldset:first-of-type .form-group {
            border-left: 0;
        }
        
        fieldset:last-of-type .form-group {
            border-right: 0;
        }
    }
    
    form.form-horizontal legend {
        padding-top: 10px;
    }
    
    
    .guideline {
        margin-bottom: 0;
    }  
}

.no-padding.no-guideline {
    form.form-horizontal.form-bordered.no-legend {
        .form-group:first-child {
            border-top: 0;
        }
    }
}


/* ======================================================== Form Vertical === */

form.form-vertical {
    
    .form-group {
        margin-bottom: $input-spacing !important;
    }
    
    legend {
        font-size: $legend;
        // font-weight: $legend-weight;
        border-bottom: 0;
        margin-bottom: 5px;
    }
    
    .control-group .input-size.align-center {
        float: none;
        margin: 0 auto;
    }
    
    .control-group .form-control-feedback {
        z-index: 5;
    }
    
    .form-group > .control-label {
        margin-bottom: 5px;
    }
}

form.form-vertical.form-column {
    .form-group {
        margin-right: $input-spacing !important;
    }
    
    fieldset:last-of-type .form-group {
        margin-right: 0 !important;
    }
}

form.form-vertical.form-bordered {
    
    legend {
        border-top: $form-border;
        border-right: $form-border;
        border-left: 0;
        border-bottom: 0;
        margin-bottom: 0;
        padding: 10px 0 10px 10px;
    }
    
    fieldset:first-of-type legend {
        border-left: $form-border;
    }
    
    .form-group {
        margin: 0 !important;
        padding: 5px 10px 10px 10px;
        border: $form-border;
        border-bottom: 0;
    }
    
    .form-group:last-child {
        border-bottom: $form-border;
    }

    .control-group {
        background-color: $foreground-color;
    }
}

form.form-vertical.form-bordered.form-striped {
    .form-group:nth-child(2n+1) {
        background-color: $background-color;
    }
    
    .form-group:nth-child(2n+1) .control-group {
        background-color: $background-color;
    }
}

form.form-vertical.form-bordered.form-column {

    .form-group {
        border-left: 0;
    }

    fieldset:first-of-type .form-group {
        border-left: $form-border;
    }
}

form.form-vertical.form-condensed {
    
    legend {
        margin-bottom: 0;
    }
    .form-group {
        padding: 0 !important;
        margin-bottom: 0 !important;
    }
    .control-label {
        padding: 0 $narrow-spacing !important;
        margin-bottom: 0;
    }
    .control-group {
        padding: 0 $narrow-spacing $narrow-spacing !important;
    }
    .submit-group {
        padding: $narrow-spacing;
    }
}

form.form-vertical.form-bordered.form-condensed {
    legend {
        border-top: $form-border;
        border-right: $form-border;
        border-left: 0;
        border-bottom: 0;
        margin-bottom: 0;
        padding: $condensed-spacing 0 $condensed-spacing $condensed-spacing;
    }
    
    fieldset:first-of-type legend {
        border-left: $form-border;
    }
}

.form-container.no-padding {
    
    form.form-vertical.form-bordered {
        
        legend {
            padding-left: $default-spacing;
            padding-right: $default-spacing;
        }
        
        .form-group {
            border-left: 0;
            border-right: 0;
        }
        
    }
 
    form.form-vertical.form-bordered.form-column {
        .form-group {
            border-right: $form-border;
        }
        
        fieldset:first-of-type .form-group {
            border-left: 0;
        }
        
        fieldset:last-of-type .form-group {
            border-right: 0;
        }
    }
    
    form.form-vertical legend {
        padding-top: 10px;
    }

    .guideline {
        margin-bottom: 0;
    }  
}

.no-padding.no-guideline {
    form.form-vertical.form-bordered.no-legend {
        .form-group:first-child {
            border-top: 0;
        }
    }
}

/* ========================================================== Form Inline === */

.form-inline.stacked-right .form-group {
    float: right;
    margin: $stacked-right-inputs-margin;
}

.form-inline.stacked-left .form-group {
    float: left;
    margin: $stacked-left-inputs-margin;
}

.form-inline.inline-top .form-group {
    vertical-align: top;
    margin: $inline-input-margin;
}

.form-inline.inline-bottom .form-group {
    vertical-align: bottom;
    margin: $inline-input-margin;
}

.form-inline {
    
    .form-group {
        padding-right: $default-spacing;
    }
    
    legend {
        font-size: $legend;
        // font-weight: $legend-weight;
        border-bottom: 0;
        margin-bottom: 5px;
    }
    
    .form-control-feedback {
        margin-top: 20px;
        z-index: 5;
    }
}
